package com.service.impl;

import com.dao.TestClassDao;
import com.model.TestClass;
import com.service.TestClassService;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Administrator on 2018-9-17 0017.
 */
@Service("testClassService")
@Transactional
public class TestClassServiceImpl implements TestClassService {

    private static Logger log = LogManager.getLogger(TestClassServiceImpl.class);

    @Autowired
    private TestClassDao testClassDao;


    @Override
    public TestClass getTestUserById(Integer userId) throws Exception {
        return testClassDao.selectByPrimaryKey(userId);
    }

    @Override
    public int insertTestUser(TestClass testUser) throws Exception {
        return testClassDao.insert(testUser);
    }

    @Override
    public int updateTestUser(TestClass testUser) throws Exception {
        return testClassDao.updateByPrimaryKeySelective(testUser);
    }

    @Override
    public List<TestClass> getAllList() throws Exception {
        return testClassDao.selectAll();
    }

    @Override
    public int deleteById(Integer userId) throws Exception {
        return testClassDao.deleteByPrimaryKey(userId);
    }

    @Override
    public int selectCount() throws Exception {
        return testClassDao.selectCount();
    }

    @Override
    public List<TestClass> getClassByName(String name) throws Exception {
        return testClassDao.selectByNameForList();
    }

    @Override
    public TestClass selectByName(String username) throws Exception {
        return testClassDao.selectByName(username);
    }
}
